package aybolit.core.objects.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Vadim
 * Date: 13.03.13
 * Time: 16:57
 * To change this template use File | Settings | File Templates.
 */
@Table(name = "oper_types", catalog = "aybolit", schema = "")
@Entity
public class OperTypes implements Serializable {
    private int operTypeId;

    @Column(name = "oper_type_id")
    @Id
    public int getOperTypeId() {
        return operTypeId;
    }

    public void setOperTypeId(int operTypeId) {
        this.operTypeId = operTypeId;
    }

    private String name;

    @Column(name = "name")
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String note;

    @Column(name = "note")
    @Basic
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        OperTypes operTypes = (OperTypes) o;

        if (operTypeId != operTypes.operTypeId) return false;
        if (name != null ? !name.equals(operTypes.name) : operTypes.name != null) return false;
        if (note != null ? !note.equals(operTypes.note) : operTypes.note != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = operTypeId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (note != null ? note.hashCode() : 0);
        return result;
    }

    private Collection<Operators> operatorsesByOperTypeId;

    @OneToMany(mappedBy = "operTypesByOperTypeId")
    public Collection<Operators> getOperatorsesByOperTypeId() {
        return operatorsesByOperTypeId;
    }

    public void setOperatorsesByOperTypeId(Collection<Operators> operatorsesByOperTypeId) {
        this.operatorsesByOperTypeId = operatorsesByOperTypeId;
    }

    private Collection<HealingDoctors> healingDoctorsesByOperTypeId;

    @OneToMany(mappedBy = "operTypesByOperTypeId")
    public Collection<HealingDoctors> getHealingDoctorsesByOperTypeId() {
        return healingDoctorsesByOperTypeId;
    }

    public void setHealingDoctorsesByOperTypeId(Collection<HealingDoctors> healingDoctorsesByOperTypeId) {
        this.healingDoctorsesByOperTypeId = healingDoctorsesByOperTypeId;
    }
}
